package com.tanhua.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.AnalysisByDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface AnalysisByDayMapper extends BaseMapper<AnalysisByDay> {

    //累计用户
    @Select("select sum(num_registered) from tb_analysis_by_day")
    Long countNumRegistered();

    //过去7天的活跃用户
    @Select("select sum(num_active) from tb_analysis_by_day where record_date between #{aWeekAgo} and #{format}")
    Integer findActivePassWeek(@Param("aWeekAgo") String aWeekAgo, @Param("format") String format);

    //过去30天的活跃用户
    @Select("select sum(num_active) from tb_analysis_by_day where record_date between #{lastMonth} and #{format}")
    Integer findActivePassMonth(@Param("lastMonth") String lastMonth,@Param("format") String format);
}
